package com.zgg.core.config

import com.zgg.MainStart
import io.vertx.core.json.DecodeException
import io.vertx.core.json.JsonObject
import kotlin.system.exitProcess

class ConfigService {
    companion object {
        private val cofigPath: String = """config.json"""
        fun loadConfig(): JsonObject {
            try {
                val config = MainStart.vertx.fileSystem().readFileBlocking(cofigPath).toString()
                return JsonObject(config)
            } catch (e: DecodeException) {
                exitProcess(1)
            } catch (e: Exception) {
                exitProcess(1)
            }
        }
    }
}